#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

vector<string> split(string str, string pattern)
{
	string::size_type pos;
	vector<string> result;
	str += pattern;
	int size = str.size();
	for (int i = 0; i < size; i++)

	{
		pos = str.find(pattern, i);
		if (pos < size)
		{
			string s = str.substr(i, pos - i);
			result.push_back(s);
			i = pos + pattern.size() - 1;
		}
	}
	return result;
}

bool checkIP(string& ip) {
	vector<string> ip_bit = split(ip, ".");
	if (ip_bit.size() != 4)
		return false;
	for (auto &str : ip_bit) {
		if (str == "") return false;
		int num = stoi(str);
		if (num < 0 || num>255) {
			return false;
		}
	}
	return true;
}


bool checkMask(string& mask) {
	if (!checkIP(mask)) return false;
	if (mask == "0.0.0.0" || mask == "255.255.255.255")
		return false;
	vector<string> mask_bit = split(mask, ".");
	string mask_bin;
	for (auto &str : mask_bit) {
		int num = stoi(str);
		string bin = "00000000";
		for (int i = 0; num > 0; i++, num /= 2) bin[i] = num % 2 + '0';
		mask_bin += bin;
	}
	int first0 = mask_bin.find_first_of('0', 0);
	int last1 = mask_bin.find_last_of('1', mask_bin.size() - 1);
	if (last1 + 1 == first0) return true;
	else return false;
}

bool checkIsPrivate(vector<string>& ip_bit) {
	if (ip_bit[0] == "10") return true;
	else if (ip_bit[0] == "172") {
		int num = stoi(ip_bit[1]);
		if (num >= 16 && num <= 31)
			return true;
		else return false;
	}
	else if (ip_bit[0] == "192"&&ip_bit[1] == "168")
		return true;
	else
		return false;
}

int main() {
	string ip_mask;
	int A = 0, B = 0, C = 0, D = 0, E = 0, error = 0, personal = 0;
	while (cin >> ip_mask) {
		string ip = split(ip_mask, "~")[0];
		string mask = split(ip_mask, "~")[1];
		if (checkIP(ip)) {
			vector<string> ip_bit = split(ip, ".");
			int first = stoi(ip_bit[0]);
			if (first == 0 || first == 127)
				continue;
			if (checkMask(mask)) {
				if (checkIsPrivate(ip_bit))
					personal += 1;
				if (first > 0 && first < 127)
					A += 1;
				else if (first > 127 && first <= 191)
					B += 1;
				else if (first >= 192 && first <= 223)
					C += 1;
				else if (first >= 224 && first <= 239)
					D += 1;
				else if (first >= 240 && first <= 255)
					E += 1;
			}
			else
				error += 1;
		}
		else
			error += 1;
	}
	cout << A << " " << B << " " << C << " " << D << " " << E << " " << error << " " << personal << endl;
	return 0;
}
